package com.qfedu.demo;

import com.qfedu.mapper.AccountRowMapper;
import com.qfedu.pojo.Account;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

import java.util.List;

public class Demo01 {
    public static void main(String[] args) {

        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("bean.xml");
        JdbcTemplate jdbcTemplate = applicationContext.getBean("jdbcTemplate", JdbcTemplate.class);


//        List<Account> list = jdbcTemplate.query("Select * from account", new BeanPropertyRowMapper<>(Account.class));
//
//        int size = list.size();
//        System.out.println(size);
        jdbcTemplate.execute("insert into account(name,money) values('hdddd',1000.0)");
    }
}
